home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
basexp
/
calc1.frm
< prev
next >
Wrap
Text File
|
1995-09-06
|
2KB
|
96 lines
VERSION 2.00
Begin Form calctest
Caption = "Sample Expression Evaluator"
ClientHeight = 4020
ClientLeft = 1680
ClientTop = 1410
ClientWidth = 7365
Height = 4425
Left = 1620
LinkTopic = "Form1"
ScaleHeight = 4020
ScaleWidth = 7365
Top = 1065
Width = 7485
Begin CommandButton Command2
Caption = "Iterate 10000"
Height = 495
Left = 4440
TabIndex = 4
Top = 1440
Width = 1695
End
Begin TextBox answer
Enabled = 0 'False
Height = 375
Left = 2700
TabIndex = 3
Top = 2640
Width = 4095
End
Begin CommandButton Command1
Caption = "Calculate"
Height = 495
Left = 2580
TabIndex = 2
Top = 1440
Width = 1215
End
Begin TextBox Text1
Height = 315
Left = 2580
TabIndex = 1
Text = "((3 + 4) * 5 - 2) * 2 - 1"
Top = 540
Width = 4035
End
Begin Label Label2
Caption = "Answer"
Height = 315
Left = 1740
TabIndex = 5
Top = 2640
Width = 915
End
Begin Label Label1
Alignment = 1 'Right Justify
Caption = "Formula"
Height = 195
Left = 1260
TabIndex = 0
Top = 600
Width = 1275
End
End
Option Explicit
Sub Command1_Click ()
answer.Text = ""
answer.Text = eval((text1.Text))
End Sub
Sub Command2_Click ()
Dim p$, i%, t$
p = text1.Text
screen.MousePointer = 11
MousePointer = 11
Refresh
For i = 1 To 10000
t = eval(p)
Next
screen.MousePointer = 0
MousePointer = 0
Beep
answer.Text = t
End Sub
Sub Form_Load ()
initcalc
End Sub
Sub Text1_GotFocus ()
text1.SelStart = 0
text1.SelLength = Len(text1.Text)
End Sub